#include "n32g45x.h"
#include "n32g45x_exti.h"

extern uint8_t key1_pressflag;
extern uint8_t key2_pressflag;
extern uint8_t key3_pressflag;

void EXTI4_IRQHandler(void){
    if(EXTI_GetITStatus(EXTI_LINE4) == RESET) return;

	key1_pressflag = 1;
	EXTI_ClrStatusFlag(EXTI_LINE4);
}

void EXTI9_5_IRQHandler(void){
    bool exti_line5_flag = EXTI_GetITStatus(EXTI_LINE5);
    bool exti_line6_flag = EXTI_GetITStatus(EXTI_LINE6);

    if(!(exti_line5_flag || exti_line6_flag)) return;

    if(exti_line5_flag) {
        key2_pressflag = 1;
        EXTI_ClrStatusFlag(EXTI_LINE5);
    }

    if(exti_line6_flag) {
        key3_pressflag = 1;
        EXTI_ClrStatusFlag(EXTI_LINE6);
    }
}
